<extend name="Layout:layout_dialog" />
<block name="body_main"> 
    <div class="xsui-page-header">
        <ul class="xsui-tabs">
            <li class="ui-state-active"><a href="{:U('product_goods_edit','id='.$data['id'])}">基本属性</a></li>
            <foreach name="content_codes" item="vo">                
                <li class="ui-state-default"><a href="{:U('product_content_edit','id='.$data['id'].'&code='.$vo['id'])}" class="lnk-content">{$vo.text}</a></li>
            </foreach>
        </ul>
    </div>
    <form action="{:U('product_goods_edit_save')}" method="post" class="xsui-form" enctype="multipart/form-data" style="min-width:800px;">
        <fieldset>
            <div class="xsui-form-field">
                <label>商品类别：</label>
                <select name="category_id" data-url="{:U('ProductCategory/get_category_tree_json')}" data-value="{$data.category_id}"></select>
            </div>
            <div class="xsui-form-field">
                <label>商品名称：</label>
                <input type="text" name="title" placeholder="商品名称" value="{$data.title}" title="{$data.title}" size="80" required="required" />
            </div>
            <div class="xsui-form-field">
                <label>商品型号：</label>
                <input type="text" name="marque" placeholder="商品型号" value="{$data.marque}" title="商品型号" required="required" />
            </div>
            <div class="xsui-form-field">
                <label>商品价格：</label>
                <input type="text" name="price" value="{$data.price|default=0}"  placeholder="商品价格" required="required" />
            </div>
            <div class="xsui-form-field">
                <label>市场价格：</label>
                <input type="text" name="market_price" value="{$data.market_price|default=0}"  placeholder="市场价格" required="required" />
            </div>
            <div class="xsui-form-field">
                <label>价格提示：</label>
                <input type="text" name="price_alt" value="{$data.price_alt|default='面议'}"  placeholder="价格提示" required="required" />
            </div>
            <div class="xsui-form-field">
                <label>隐藏价格：</label>
                <input type="checkbox" name="price_status" value="Y" title="是否显示销售价格" />
            </div>
            <div class="xsui-form-field">
                <label>商品图片：</label>
                <sohtml:file name="picture_url" value="{$data.picture_url}" />
            </div>
            <div class="xsui-form-field-vertical">
                <label>摘要内容：</label>
                <textarea name="summary" placeholder="摘要内容" cols="91" rows="3">{$data.summary}</textarea>
            </div>
            <div class="xsui-form-field">
                <label>发布时间：</label>
                <input type="text" name="create_time" value="{$data.create_time|default=date('Y-m-d H:i:s')}" placeholder="发布时间" class="datetimepicker" />
            </div>
            <div class="xsui-form-field xsui-form-mgb">
                <label>状态：</label>
                <sohtml:radio name="status" items="1:上架;0:下架" value="{$data.status|default='1'}" required="required" />
            </div>
        </fieldset>
        <button type="submit" class="ui-state-default"><i class="fa fa-save"></i>发布</button>
        <button type="reset" class="ui-state-default">重置</button>
        <input type="hidden" name="id" value="{$data.id}"/>
        <input type="hidden" name="site_id" value="{$data.site_id}"/>
        <input type="hidden" name="user_name" value="{$data.user_name}"/>
    </form>
</block>
<block name="body_after">
    <script>
        $(function () {
            ajax_combobox({selector: 'select[name="category_id"]', def_option: '请选择类别'});
            $('.lnk-content').click(function () {
                if (!$('input[name="id"]').val()) {
                    alert('请先保存商品!');
                    return false;
                }
            })
        })
    </script>
</block>